
import React, { useEffect } from 'react'
import MRouter from './router/IndexRouter'
import Tabbar from './components/Tabbar'
// import store from './redux/store'
import {connect} from 'react-redux'
function App (props) {
    // const [isShow, setIsshow] = useState(store.getState().TabbarReducer.show)
    useEffect(() => {
        // 订阅
        // store.subscribe(() => {
        //     console.log("app订阅", props.store.getState())
        //     setIsshow(store.getState().TabbarReducer.show)
        // })
    }, [])

    return (
        
        <div>
            {/* 路由切换 */}
            <MRouter>
                {props.isShow && <Tabbar></Tabbar>}
            </MRouter>
        </div>
    )
}

const mapStateToProps=(state)=>{
    return{
        isShow:state.TabbarReducer.show
    }
}
export default connect(mapStateToProps)(App)
